﻿using System;
using System.ComponentModel;

namespace ExFlash.Records
{
    [TypeConverter(typeof(ExpandableObjectConverter))]
    public class GylphEntry : ISwfSerializable
    {
        private readonly ushort _advanceBits;
        private readonly ushort _gylphBits;

        public uint GylphIndex
        {
            get;
            protected set;
        }

        public int GylphAdvance
        {
            get;
            protected set;
        }

        public GylphEntry(ushort gylphBits, ushort advanceBits)
        {
            _advanceBits = advanceBits;
            _gylphBits = gylphBits;
        }

        #region ISwfSerializable Members

        public void SwfDeserialize(BinaryBitReader reader)
        {
            GylphIndex = reader.ReadUInt32(_gylphBits);
            GylphAdvance = reader.ReadInt32(_advanceBits);
            //reader.AlignBits();
        }

        public void SwfSerialize(byte[] arr, ref int offset)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
